<template>
    <div class="new_contains">
        <h1 class="new_title">{{newinfo.title}}</h1>
        <div class="sub_title">
            <span>发表时间:{{newinfo.add_time}}</span>
            <span>点击：{{newinfo.click}} 次 </span>
        </div>
        <hr>
        <div class="newc" v-html="newinfo.content"></div>

        <comment-box :id="id"></comment-box>
        
    </div>
    
</template>
<script>
import {Toast} from "mint-ui"
import comment from "../subcomponent/comment.vue"
export default{
    data(){
        return {
            id:this.$route.params.id,
            newinfo:{}
        }
    },  
    created(){
        this.getnewinfo();
    },
    methods:{
        getnewinfo(){
            this.$http.get("api/getnew/"+this.id).then(results => {
                if(results.body.status===0){
                    this.newinfo = results.body.message[0]
                }else{
                    Toast("出错啦")
                }
            })
        }
       
    },
    components:{
        "comment-box":comment
    }

}


</script>
<style lang="scss" scoped>
    .new_contains{
        padding: 0 4px;
        .new_title{
            font-size:14px;
            color:red;
            text-align: center;
        }
        .sub_title{
            display:flex;
            justify-content: space-between;
            color:blue;
            font-size:12px;
        }
    }
</style>